<template>
  <div>
    <el-dialog :visible.sync="dialog.detail" title="详情" width="80%" append-to-body>
      <div class="detail-info">
        <el-row>
          <el-col :xs="24" :sm="24" :md="12" :lg="12" :xl="8">
            <span class="detail-title">配置名称：</span>
            <span v-text="form.name"></span>
          </el-col>
          <el-col :xs="24" :sm="24" :md="12" :lg="12" :xl="8">
            <span class="detail-title">配置内容(JSON)：</span>
          <el-button type="text" @click="showJsonDialog(form.value)">点击查看</el-button>

          </el-col>
          <el-col :xs="24" :sm="24" :md="12" :lg="12" :xl="8">
            <span class="detail-title">配置注释：</span>
            <el-button type="text" @click="showJsonDialog(form.comment)">点击查看</el-button>
          </el-col>
          <el-col :xs="24" :sm="24" :md="12" :lg="12" :xl="8">
            <span class="detail-title">中文说明：</span>
            <span v-text="form.description"></span>
          </el-col>
          <el-col :xs="24" :sm="24" :md="12" :lg="12" :xl="8">
            <span class="detail-title">允许外部访问：</span>
            <span v-text="form.outsideAccess"></span>
          </el-col>
          <el-col :xs="24" :sm="24" :md="12" :lg="12" :xl="8">
            <span class="detail-title">版本号：</span>
            <span v-text="form.version"></span>
          </el-col>
          <el-col :xs="24" :sm="24" :md="12" :lg="12" :xl="8">
            <span class="detail-title">创建时间：</span>
            <span v-text="form.createTime"></span>
          </el-col>
          <el-col :xs="24" :sm="24" :md="12" :lg="12" :xl="8">
            <span class="detail-title">更新时间：</span>
            <span v-text="form.updateTime"></span>
          </el-col>
          <el-col :xs="24" :sm="24" :md="12" :lg="12" :xl="8">
            <span class="detail-title">是否可用：</span>
            <span v-text="form.isActive"></span>
          </el-col>
        </el-row>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button type="primary" @click="dialog.detail = false">关闭</el-button>
      </span>
    </el-dialog>
        <JsonDialog ref="JsonDialog"/>
  </div>
</template>

<script>
import * as utils from '@/utils/utils'
import * as ResponseStatus from '@/utils/response-status'
const resUrl = process.env.VUE_APP_RES_URL
import JsonDialog from '@/components/JsonDialog'
export default {
  name: 'SysConfigDetail',
    components: {
    JsonDialog  
  },
  data() {
    return {
      dialog: {
        detail: false,
      },
      form: {
        id: undefined,
        name: undefined,
        value: undefined,
        comment: undefined,
        description: undefined,
        outsideAccess: undefined,
        version: undefined,
        createTime: undefined,
        updateTime: undefined,
        isActive: undefined,
      },
      dataDictCodes: ['YES_NO'],
      resUrl: resUrl,
    }
  },
  computed: {},
  mounted() {},
  methods: {
    getDictItemsDisplayValue() {
      utils
        .getDataDict(this.dataDictCodes)
        .then((response) => {
          if (response) {
            if (response) {
              utils.getDetailDictItemDisplayValue({
                mainComponent: this,
                dataDictItems: response,
                dictCode: 'YES_NO',
                formProp: 'outsideAccess',
              })
              utils.getDetailDictItemDisplayValue({
                mainComponent: this,
                dataDictItems: response,
                dictCode: 'YES_NO',
                formProp: 'isActive',
              })
            }
          }
        })
        .catch((error) => {
          console.log(error)
        })
    },
    showJsonDialog(value) {
      const jsonDialog = this.$refs.JsonDialog
      jsonDialog.json = JSON.parse(value)
      jsonDialog.dialog = true

    },
  },
}
</script>

<style>
</style>